<?php $this->Html->scriptStart(array('inline' => false)); ?>$(document).ready(function(){	$.validator.defaults.errorElement = 'div';	$('#<?php echo $id; ?>').validate({		rules: <?php echo json_encode($rules); ?>,		messages: <?php echo json_encode($messages); ?>,		errorPlacement: function(error, element) {				error.addClass('error-message');			if(element.parent().hasClass('loginInput')) {				error.attr('style', 'padding-left:95px;');				error.insertAfter(element.parent().next());			} else {				error.insertAfter(element);						}		},	});});<?php $this->Html->scriptEnd(); ?>